package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.pojo.entity.SubjectFile;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SubjectFileMapper extends BaseMapper<SubjectFile> {
    //学科附带添加file后完善根据自增nodeId---更新nodeId
    @Update("UPDATE test.subject_file SET node_id = #{nodeId} WHERE id = #{id}")
    void updateNodeId(@Param("id")int id, @Param("nodeId")String nodeId);
    //根据nodeId查找子类id
    @Select("SELECT * FROM test.subject_file where  node_id like CONCAT(#{nodeId}, '%') and level=#{level}")
    List<SubjectFile>selectChildrenFile(@Param("nodeId")String nodeId,@Param("level")int level);
}
